tests: fix flaky test_simple_close_dust_output_omitted mempool race#9299
Open
ksedgwic wants to merge 1 commit into
Open
tests: fix flaky test_simple_close_dust_output_omitted mempool race#9299ksedgwic wants to merge 1 commit into
ksedgwic wants to merge 1 commit into
Conversation
The test snapshots getrawmempool() and then calls getrawtransaction() on each txid. In simple close both peers broadcast conflicting closer txs: here l2's tx pays only 400sat fee (its entire 400sat balance goes to fees since its own output is dust) while l1's pays 3375sat, so l1's tx can RBF-replace l2's between the snapshot and the fetch. The getrawtransaction() call on the replaced txid then fails with error -5 (No such mempool or blockchain transaction). A CI failure showed exactly this ordering: l2 broadcast its closer tx, l1's higher-fee tx replaced it 14ms later, and the test's per-txid fetch raced the replacement. Retry the whole snapshot-and-check loop when a txid vanishes mid-iteration, keeping the single-output assertion hard. This is the same class of mempool race fixed for test_simple_close_delay_broadcast in 5ae0705 ("tests: fix flaky test_simple_close_delay_broadcast mempool race"). Changelog-None
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Observed on a CI run for #9286 (postgres full integration, 1 failed / 1012 passed):
https://github.com/ElementsProject/lightning/actions/runs/28971841260
The test snapshots getrawmempool() and then fetches each txid with
getrawtransaction(). Both peers broadcast conflicting closer txs; in
the dust scenario l2's tx pays only 400sat fee (its whole balance)
while l1's pays 3375sat, so l1's tx RBF-replaces l2's. When the
replacement lands between the snapshot and the fetch,
getrawtransaction() fails with error -5 (No such mempool or blockchain
transaction). The captured node logs show l2's tx replaced 14ms after
broadcast.
The fix retries the snapshot-and-check loop when a txid vanishes
mid-iteration; the single-output assertion still fails hard. Same
class of race as the test_simple_close_delay_broadcast fix in
5ae0705.
Changelog-None